<!-- polls/templates/polls/detail.html -->
{% extends "polls/base.html" %}

{% block title %}投票详情 - {{ question.question_text }}{% endblock %}

{% block content %}
<div class="text-center mb-5">
    <h1 class="display-5 fw-bold text-dark mb-3">{{ question.question_text }}</h1>
    <p class="text-muted">请选择您的投票选项</p>
</div>

{% if error_message %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
    {{ error_message }}
    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endif %}

<form action="{% url 'polls:vote' question.id %}" method="post">
    {% csrf_token %}
    <div class="list-group">
        {% for choice in question.choice_set.all %}
        <label class="list-group-item d-flex gap-3 py-3">
            <input class="form-check-input flex-shrink-0" 
                   type="radio" 
                   name="choice" 
                   id="choice{{ forloop.counter }}" 
                   value="{{ choice.id }}">
            <div class="w-100">
                <h6 class="mb-1">{{ choice.choice_text }}</h6>
                <small class="text-muted">当前得票：{{ choice.votes }}</small>
            </div>
        </label>
        {% endfor %}
    </div>
    
    <div class="d-grid gap-2 mt-4">
        <button type="submit" class="btn btn-lg vote-btn">
            <i class="bi bi-check2-circle me-2"></i>
            提交投票
        </button>
    </div>
</form>
{% endblock %}
